package LeetCode;

public class Num80 {
    public int removeDuplicates(int[] nums) {
        return process(nums,2);

    }

    private int process(int[] nums, int k) {
        int idx=0;
        for (int x:nums) {
            if(idx<k || nums[idx-k]!=x){
                nums[idx++]=x;
            }
        }
        return idx;
    }
}
